package com.hailong.zyt.service.impl;

import com.hailong.zyt.beans.Course;
import com.hailong.zyt.beans.CourseAll;
import com.hailong.zyt.mapper.CourseAllMapper;
import com.hailong.zyt.service.CourseAllService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hailong
 * @since 2021-05-17
 */
@Service
public class CourseAllServiceImpl extends ServiceImpl<CourseAllMapper, CourseAll> implements CourseAllService {

    protected CourseAllMapper courseAllMapper;

    @Override
    public Integer getCourseCount(Long stuId) {
        Integer count = courseAllMapper.selectCourseCount(stuId);
        return count == null ? 0 : count;
    }

    @Override
    public List<Course> getStudentAllCourseById(Long stuId) {
        List<Course> courses = courseAllMapper.selectAllCourseById(stuId);
        return courses;
    }

    public CourseAllMapper getCourseAllMapper() {
        return courseAllMapper;
    }

    @Autowired
    public void setCourseAllMapper(CourseAllMapper courseAllMapper) {
        this.courseAllMapper = courseAllMapper;
    }
}
